package net.kangyee.eventmanager.util;

import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;

public class MessageManager {
	
	//消息前缀
	private static String prefix;
	private static String adminPrefix;
	private static String pluginPrefix = "&f[&6活动管理&f]";
	
	//发送普通消息(全体)
	public static void sendNormalMessageToAll(String string){
		Bukkit.getServer().broadcastMessage(prefix + ChatColor.translateAlternateColorCodes('&', string));
	}
	
	//发送普通消息,以插件身份
	public static void sendPNormalMessage(Player player, String string){
		player.sendMessage(ChatColor.translateAlternateColorCodes('&', pluginPrefix + string));
	}
	
	//发送普通消息
	public static void sendNormalMessage(Player player, String string){
		player.sendMessage(prefix + ChatColor.translateAlternateColorCodes('&', string));
	}
	
	//发送活动管理员消息
	public static void sendAdminMessage(Player player, String string){
		player.sendMessage(adminPrefix + ChatColor.translateAlternateColorCodes('&', string));
	}
	
	//发送无权限消息
	public static void sendNoPermMessage(Player player, String permissionName){
		player.sendMessage(prefix + ChatColor.RED + "你没有相应的权限来使用本命令[" + permissionName + "]");
	}
	
	//设置消息前缀
	public static void setMessagePrefix(String pre, String aPre){
		prefix = ChatColor.translateAlternateColorCodes('&', pre);
		adminPrefix = ChatColor.translateAlternateColorCodes('&', aPre);
	}	
	
}
